<template>
	<view class="wrap">
		<form>
			<view class="form_item_h">
				<view class="h" style="width: 70%;">
					退费详情
				</view>
				<view style="width: 20%;text-align: end;color: #ff5a00;">
					{{item.refundState==1?'待审核':item.refundState==2?'审核中':item.refundState==3?'审核完毕':item.refundState==4?'已驳回':''}}
				</view>
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text"></text><text>合同名称</text>
				</view>
				<view class="input">
					{{list.contractName}}
				</view>
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text"></text><text>用户</text>
				</view>
				<view class="input">
					{{list.cardName}}
				</view>
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text"></text><text>退押金</text>
				</view>
				<!-- <input type="text" placeholder-class="font_size" placeholder="请输入退余押金金额" v-model="list.refundDeposit"> -->
				<view class="input">
					{{list.refundDeposit}}
				</view>
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text"></text><text>退租金</text>
				</view>
				<!-- <input type="text" placeholder-class="font_size" placeholder="请输入退余房租金额" v-model="fz"> -->
				<view class="input">
					{{list.refundRent}}
				</view>
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text"></text><text>银行名称</text>
				</view>
				<view class="input">
					{{list.bankName}}
				</view>
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text"></text><text>卡号</text>
				</view>
				<view class="input">
					{{list.bankNum}}
				</view>
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text"></text><text>收款人</text>
				</view>
				<view class="input">
					{{list.bankUser}}
				</view>
			</view>

			<view class="from_file" style="border: none;" v-if="postCode=='caiwu'">
				<view class="label">
					<text class="label_text">*</text><text>发票图片</text>
				</view>
			</view>
			<uni-file-picker v-if="postCode=='caiwu'" class="file" v-model="refundUrlList" fileMediatype="image"
				limit="1" mode="grid" @select="refundSelect" @fail="refundFail" @delete="refundDel"
				:disabled="postCode=='caiwu'?false:true" :del-icon="postCode=='caiwu'?true:false" />

			<view class="from_file" style="border: none;">
				<view class="label">
					<text class="label_text">*</text><text>室内图片</text>
				</view>
			</view>
			<uni-file-picker class="file" v-model="roomUrlList" fileMediatype="image" limit="9" mode="grid"
				@select="roomSelect" @fail="roomFail" @delete="roomDel" :disabled="refundState" :del-icon="delIcon" />


			<view class="form_item">
				<view class="label">
					<text class="label_text">*</text><text>水表数值</text>
				</view>
				<!-- <input type="digit" placeholder-class="font_size" placeholder="请输入水表数值" v-model.trim="waterNum"
					@blur="waterNum = waterNum.trim().replace(/[^\d\.]/g,'')"> -->
				<input type="digit" placeholder-class="font_size" placeholder="请输入水表数值" v-model.trim="waterNum"
					@blur="waterNum = waterNum.trim().replace(/[^\d\.]/g,'')">
				<!-- .replace(/[^0-9.-]/g, '') .replace(/(\..*)\./g, '$1') .replace(/(?!^)-/g, '').replace(/^0+(\d)/gm, '$1') -->
				<!-- <input type="digit" placeholder-class="font_size" placeholder="请输入水表数值" v-model.trim="waterNum"
					@blur="waterNum = waterNum.trim().replace(/\s+/g,'')"> -->
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text">*</text><text>电表数值</text>
				</view>
				<input type="digit" placeholder-class="font_size" placeholder="请输入电表数值" v-model.trim="electricityNum"
					@blur="electricityNum = electricityNum.trim().replace(/[^\d\.]/g,'')">
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text">*</text><text>燃气表数</text>
				</view>
				<input type="digit" placeholder-class="font_size" placeholder="请输入燃气表数,无则输入0" v-model.trim="gasNum"
					@blur="gasNum = gasNum.trim().replace(/[^\d\.]/g,'')">
			</view>
			<view class="from_file" style="border: none;">
				<view class="label">
					<text class="label_text">*</text><text>水电燃气表图片</text>
				</view>
			</view>
			<uni-file-picker class="file" v-model="otherUrlList" fileMediatype="image" limit="9" mode="grid"
				@select="otherSelect" @fail="otherFail" @delete="otherDel" :disabled="refundState"
				:del-icon="delIcon" />

			<view class="form_item">
				<view class="label">
					<text class="label_text">*</text><text>水费</text>
				</view>
				<input type="digit" placeholder-class="font_size" placeholder="请输入使用水费金额,无则输入0"
					v-model.trim="refundWater" @blur="refundWater = refundWater.trim().replace(/[^\d\.]/g,'')">
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text">*</text><text>电费</text>
				</view>
				<input type="digit" placeholder-class="font_size" placeholder="请输入使用电费金额,无则输入0"
					v-model.trim="refundElectricity"
					@blur="refundElectricity = refundElectricity.trim().replace(/[^\d\.]/g,'')">
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text">*</text><text>燃气费</text>
				</view>
				<input type="digit" placeholder-class="font_size" placeholder="请输入使用电费金额,无则输入0" v-model.trim="refundGas"
					@blur="refundGas = refundGas.trim().replace(/[^\d\.]/g,'')">
			</view>

			<view class="form_item">
				<view class="label">
					<text class="label_text">*</text><text>赔偿金额</text>
				</view>
				<input type="digit" placeholder-class="font_size" placeholder="请输入赔偿金额,无则输入0" v-model.trim="damages"
					@blur="damages = damages.trim().replace(/[^\d\.]/g,'')">
			</view>
			<view class="from_file" style="border: none;">
				<view class="label">
					<text class="label_text"></text><text>物品损坏图片</text>
				</view>
			</view>
			<uni-file-picker class="file" v-model="damageUrlList" fileMediatype="image" limit="9" mode="grid"
				@select="damageSelect" @fail="damageFail" @delete="damageDel" :disabled="refundState"
				:del-icon="delIcon" />


			<view class="form_item">
				<view class="label">
					<text class="label_text"></text><text>物品损坏介绍</text>
				</view>
			</view>
			<textarea type="text" placeholder-class="placeholder_textarea" placeholder="请输入物品损坏介绍"
				v-model="damage"></textarea>

			<view class="form_item">
				<view class="label">
					<text class="label_text">*</text><text>违约金</text>
				</view>
				<input type="digit" placeholder-class="font_size" placeholder="请输入违约金,无则输入0" v-model.trim="defaultPrice"
					@blur="defaultPrice = defaultPrice.trim().replace(/[^\d\.]/g,'')">
				<!-- 	<input type="digit" placeholder-class="font_size" placeholder="请输入违约金,无则输入0" v-model.trim="defaultPrice"
					@blur="defaultPrice = defaultPrice.trim().replace(/\s+/g,'')"> -->
			</view>
			<view class="form_item">
				<view class="label">
					<text class="label_text">*</text><text>逾期金额</text>
				</view>
				<!-- <input type="text" placeholder-class="font_size" placeholder="请输入实际退费总金额" v-model="all"> -->
				<view class="input">
					{{expirePrice}}
				</view>
			</view>
			<view class="form_item" v-if="refundPrice!=null">
				<view class="label">
					<text class="label_text">*</text><text>实际退费总金额</text>
				</view>
				<!-- <input type="text" placeholder-class="font_size" placeholder="请输入实际退费总金额" v-model="all"> -->
				<view class="input">
					{{refundPrice}}
				</view>
			</view>


			<view class="form_item">
				<view class="label">
					<text class="label_text">*</text><text>申请时间</text>
				</view>
				<view class="input">{{list.refundTime}}</view>
			</view>
			<!-- <view class="form_item">
				<view class="label">
					<text class="label_text" style="margin-top: 4rpx;">*</text><text>退费时间</text>
				</view>
				<uni-datetime-picker class="datetime" type="datetime" v-model="datetimesingle" @change="changeLog" />
			</view> -->

			<view class="form_item">
				<view class="label">
					<text class="label_text"></text><text>退费详情</text>
				</view>
				<!-- <input type="text" placeholder-class="font_size" placeholder="请输入退费详情" v-model="mon"> -->
			</view>
			<textarea type="text" placeholder-class="font_size" placeholder="请输入退费详情"
				v-model="refundDetails"></textarea>

			<view class="form_item">
				<view class="label">
					<text class="label_text"></text><text>驳回详情</text>
				</view>
				<!-- <input type="text" placeholder-class="font_size" placeholder="请输入驳回详情" v-model="mon"> -->
			</view>
			<textarea type="text" placeholder-class="font_size" placeholder="请输入驳回原因" v-model="reject"></textarea>

			<view style="margin: 30rpx 0;">
				<uni-steps :options="steps" active-color="#ff5a00" :active="active" direction="reject" />
			</view>
			<view style="width: 100%;height: 11vh;"></view>
		</form>
		<view class="fixed" style="display: flex;" v-if="permission!=1">
			<view class="btn" style="background: #ff0000ed;margin-left: 0;" @click="btn(2)">驳回</view>
			<view class="btn" style="background: #ff5a00;margin-left: 40rpx;" @click="btn(1)">同意</view>
		</view>
	</view>
</template>

<script module="utils" lang="wxs" src="../../utils/imgSrc.wxs"></script>

<script>
	import config from '../../config.js';

	import {
		throttle
	} from "@/utils/throttle.js"

	export default {
		data() {
			return {
				permission: uni.getStorageSync('permission'),
				postCode: uni.getStorageSync('user'),

				list: [],
				datetimesingle: '',
				refundId: '',
				roomFile: [],
				roomUrlList: [],
				roomFileList: [],
				roomMessage: '',
				refundState: true,

				refundFile: [],
				refundUrlList: [],
				refundFileList: [],
				refundMessage: '',

				otherFile: [],
				otherUrlList: [],
				otherFileList: [],
				otherMessage: '',

				damageFile: [],
				damageUrlList: [],
				damageFileList: [],
				damageMessage: '',

				refundPrice: '',
				refundDeposit: 0,
				refundRent: '',
				refundWater: '',
				refundElectricity: '',
				waterNum: '',
				electricityNum: '',
				damages: '',
				defaultPrice: '',
				reject: '',
				damage: '',
				refundDetails: '',
				gasNum: '',
				refundGas: '',
				expirePrice: '',
				delIcon: true,
			};
		},

		onLoad(option) {
			this.refundId = option.refundId
			this.picList()
			let data = {
				refundId: option.refundId
			}
			this.api.get('hetong/refund/app/selRefundIdById', data).then(res => {
				if (res.data.code == 200) {
					this.list = res.data.data
					let url = {
						url: res.data.data.refundImgUrl
					}
					this.refundUrlList.push(url)

					if (res.data.data.refundState == '1') {
						this.refundState = false
						this.delIcon = true
					} else {
						if (res.data.data.refundState == '4') {
							this.refundState = false
							this.delIcon = true
						} else {
							this.refundState = true
							this.delIcon = false
						}
						this.gasNum = this.list.gasNum
						this.reject = this.list.reject
						this.refundDetails = this.list.refundDetails
						this.refundPrice = this.list.refundPrice
						this.expirePrice = this.list.expirePrice
						this.damage = this.list.damage
						this.refundGas = this.list.refundGas
						this.refundElectricity = this.list.refundElectricity
						this.waterNum = this.list.waterNum
						this.damages = this.list.damages
						this.electricityNum = this.list.electricityNum
						this.refundWater = this.list.refundWater
						this.defaultPrice = this.list.defaultPrice
					}

					if (res.data.data.expirePrice != null) {
						this.expirePrice = res.data.data.expirePrice
					} else {
						this.expirePrice = 0
					}
				}
			})
		},
		onShow() {},
		onReady() {},
		methods: {
			numFilter(value) {
				let tempVal = parseFloat(value).toFixed(2)
				let realVal = tempVal.substring(0, tempVal.length - 1)
				return realVal
			},
			order() {
				let data = {
					contractId: this.list.contractId,
					payPrice: this.refundPrice
				}
				this.api.post('hetong/contract/app/newPayPrice', data).then(res => {
					if (res.data.code == 200) {
						uni.showToast({
							title: '支付成功',
							icon: 'none',
							duration: 1500
						});
					} else {
						uni.showToast({
							title: res.data.msg,
							icon: 'none',
							duration: 1500
						});
					}
				})
			},

			refundSelect(e) {
				e.tempFilePaths.forEach((item) => {
					uni.uploadFile({
						url: config.apiUrl + 'hetong/contract/app/upload',
						method: 'POST',
						dataType: 'json',
						filePath: item,
						name: 'file',
						success: uploadFileRes => {
							let data = JSON.parse(uploadFileRes.data)
							// 上传图片 二维编码
							this.refundFile.push(item)
							if (data.code == 200) {
								// 上传图片回显
								let url = {
									url: data.data.url
								}
								this.refundUrlList.push(url)
								// 上传图片 id
								this.refundFileList.push(data.data.ossId)
							} else {
								uni.showToast({
									title: '格式错误，请重新上传',
									icon: 'none',
									duration: 1500
								});
							}
						},
						fail(err) {
							console.log(err);
						}
					});
				})
			},
			refundFail() {
				uni.showToast({
					title: '操作失败，请稍后再试',
					icon: 'none',
					duration: 1500
				});
				this.refundFile = []
				this.refundUrlList = []
				this.refundFileList = []
			},
			refundDel(e) {
				let id = this.refundFile.indexOf(e.tempFilePath)
				this.refundFile.splice(id, 1)
				this.refundUrlList.splice(id, 1)
				this.refundFileList.splice(id, 1)
			},
			roomSelect(e) {
				e.tempFilePaths.forEach((item) => {
					uni.uploadFile({
						url: config.apiUrl + 'hetong/contract/app/upload',
						method: 'POST',
						dataType: 'json',
						filePath: item,
						name: 'file',
						success: uploadFileRes => {
							let data = JSON.parse(uploadFileRes.data)
							// 上传图片 二维编码
							this.roomFile.push(item)
							if (data.code == 200) {
								// 上传图片回显
								let url = {
									url: data.data.url
								}
								this.roomUrlList.push(url)
								// 上传图片 id
								this.roomFileList.push(data.data.ossId)
							} else {
								uni.showToast({
									title: '格式错误，请重新上传',
									icon: 'none',
									duration: 1500
								});
							}
						},
						fail(err) {
							console.log(err);
						}
					});
				})
			},
			roomFail() {
				uni.showToast({
					title: '操作失败，请稍后再试',
					icon: 'none',
					duration: 1500
				});
				this.roomFile = []
				this.roomUrlList = []
				this.roomFileList = []
			},
			roomDel(e) {
				let id = this.roomFile.indexOf(e.tempFilePath)
				this.roomFile.splice(id, 1)
				this.roomUrlList.splice(id, 1)
				this.roomFileList.splice(id, 1)
			},

			otherSelect(e) {
				e.tempFilePaths.forEach((item) => {
					uni.uploadFile({
						url: config.apiUrl + 'hetong/contract/app/upload',
						// header: {
						// 	'Content-Type': 'application/x-www-form-urlencoded'
						// },
						method: 'POST',
						dataType: 'json',
						filePath: item,
						name: 'file',
						success: uploadFileRes => {
							let data = JSON.parse(uploadFileRes.data)
							// 上传图片 二维编码
							this.otherFile.push(item)
							// console.log('1', this.otherFile);
							if (data.code == 200) {
								// console.log(data.data);
								// 上传图片回显
								let url = {
									url: data.data.url
								}
								this.otherUrlList.push(url)

								// console.log('2', this.otherUrlList);
								// 上传图片 id
								this.otherFileList.push(data.data.ossId)

								// console.log(this.otherFileList);
							} else {
								uni.showToast({
									title: '格式错误，请重新上传',
									icon: 'none',
									duration: 1500
								});
							}
						},
						fail(err) {
							console.log(err);
						}
					});
				})
			},
			otherFail() {
				uni.showToast({
					title: '操作失败，请稍后再试',
					icon: 'none',
					duration: 1500
				});
				this.otherFile = []
				this.otherUrlList = []
				this.otherFileList = []
			},
			otherDel(e) {
				console.log(e);
				let id = this.otherFile.indexOf(e.tempFilePath)
				// console.log(id);
				// let index = this.otherUrlList.indexOf(e.tempFilePath)
				// if (index) {
				// 	this.otherUrlList.splice(index, 1)
				// }
				this.otherUrlList.splice(id, 1)
				this.otherFile.splice(id, 1)
				this.otherFileList.splice(id, 1)
			},

			damageSelect(e) {
				e.tempFilePaths.forEach((item) => {
					uni.uploadFile({
						url: config.apiUrl + 'hetong/contract/app/upload',
						// header: {
						// 	'Content-Type': 'application/x-www-form-urlencoded'
						// },
						method: 'POST',
						dataType: 'json',
						filePath: item,
						// filePath: e.tempFilePaths[0],
						name: 'file',
						success: uploadFileRes => {
							let data = JSON.parse(uploadFileRes.data)
							// 上传图片 二维编码
							this.damageFile.push(item)
							// this.damageFile.push(e.tempFilePaths[0])
							// console.log('1', this.damageFile);
							if (data.code == 200) {
								// console.log(data.data);
								// 上传图片回显
								let url = {
									url: data.data.url
								}
								this.damageUrlList.push(url)

								// console.log('2', this.damageUrlList);
								// 上传图片 id
								console.log(data.data.ossId);
								this.damageFileList.push(data.data.ossId)

								// console.log(this.damageFileList);
							} else {
								uni.showToast({
									title: '格式错误，请重新上传',
									icon: 'none',
									duration: 1500
								});
							}
						},
						fail(err) {
							console.log(err);
						}
					});
				})
			},
			damageFail() {
				uni.showToast({
					title: '操作失败，请稍后再试',
					icon: 'none',
					duration: 1500
				});
				this.damageFile = []
				this.damageUrlList = []
				this.damageFileList = []
			},
			damageDel(e) {
				let id = this.damageFile.indexOf(e.tempFilePath)
				// console.log(id);
				this.damageFile.splice(id, 1)
				this.damageFile.splice(id, 1)
				// let index = this.otherUrlList.indexOf(e.tempFilePath)
				// if (index) {
				// 	this.damageFile.splice(index, 1)
				// }
				this.damageFileList.splice(id, 1)
			},

			PicFun(index) {
				let parem = ''
				// refundState 1 第一级管理员
				console.log(this.list.refundState);
				if (this.list.refundState == 1 || this.list.refundState == 4) {
					let data = {
						refundId: this.refundId,
						defaultImgs: this.roomFileList.join(","),
						damageImgs: this.damageFileList.join(","),
						dashboardImgs: this.otherFileList.join(","),
					}

					parem = JSON.stringify(data)
				} else {
					parem = {
						refundId: this.refundId,
						defaultImgs: this.roomFileList,
						damageImgs: this.damageFileList,
						dashboardImgs: this.otherFileList,
					}
				}

				this.api.post('hetong/refund/app/refundImg', parem).then(res => {
					if (res.data.code == 200) {

					}
				})
			},

			picList() {
				let data = {
					refundId: this.refundId
				}
				// let roomUrlList = []
				// let otherUrlList = []
				// let damageUrlList = []
				this.api.get('hetong/refund/app/getRefundImg', data).then(res => {
					if (res.data.code == 200) {
						for (let i = 0; i < res.data.data.defaultImgs.imgUrls.length; i++) {
							let url = {}
							url.url = res.data.data.defaultImgs.imgUrls[i]
							this.roomUrlList.push(url)
							this.roomFile.push(res.data.data.defaultImgs.imgUrls[i])
						}
						for (let l = 0; l < res.data.data.dashboardImgs.imgUrls.length; l++) {
							let url = {
								url: res.data.data.dashboardImgs.imgUrls[l]
							}
							this.otherUrlList.push(url)
							this.otherFile.push(res.data.data.dashboardImgs.imgUrls[l])
						}
						for (let z = 0; z < res.data.data.damageImgs.imgUrls.length; z++) {
							let url = {
								url: res.data.data.damageImgs.imgUrls[z]
							}
							this.damageUrlList.push(url)
							this.damageFile.push(res.data.data.damageImgs.imgUrls[z])
						}

						let roomFileList = res.data.data.defaultImgs.ossIds
						let roomFileListOssid = roomFileList.split(',')
						this.roomFileList = roomFileListOssid

						let dashboardImgs = res.data.data.dashboardImgs.ossIds
						let otherFileListOssid = dashboardImgs.split(',')
						this.otherFileList = otherFileListOssid

						let damageImgs = res.data.data.dashboardImgs.ossIds
						let damageFileListOssid = dashboardImgs.split(',')
						this.damageFileList = damageFileListOssid
					}
				})
			},

			money(value) {
				return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value);
			},


			btn(index) {
				let data = {
					refundChange: this.list.refundChange,
					refundId: this.refundId,
					postCode: uni.getStorageSync('user'),
					openId: uni.getStorageSync('openId'),
					result: index,
					contractId: this.list.contractId,
					deptId: this.list.deptId,
					appCode: 'a',
					trialName: this.list.trialName,
					// 实际退费总金额
					refundPrice: this.refundPrice,
					refundDeposit: this.list.refundDeposit,
					refundRent: this.list.refundRent,
					refundWater: this.refundWater,
					refundElectricity: this.refundElectricity,
					waterNum: this.waterNum,
					electricityNum: this.electricityNum,
					gasNum: this.gasNum,
					refundGas: this.refundGas,
					damages: this.damages,
					defaultPrice: this.defaultPrice,
					refundTime: this.list.refundTime,
					refundDetails: this.refundDetails,
					refundState: this.list.refundState,
					reject: this.reject,
					damage: this.damage,
					dayNum: this.list.dayNum,
					deptName: this.list.deptName,
					contractForm: this.list.contractForm,
					contractPhone: this.list.contractPhone,
					endTime: this.list.endTime,
					contractDeposit: this.list.contractDeposit,
					contractName: this.list.contractName,
					cardName: this.list.cardName,
					endRefundTime: this.list.endRefundTime,
					expirePrice: this.expirePrice,
					refundImg: this.refundFileList.join(","),
				}
				if (this.refundPrice != null) {
					if (index == 1) {
						if (this.roomUrlList.length == 0) {
							uni.showToast({
								title: '请上传室内图片',
								icon: 'none',
								duration: 1500
							});
						} else if (this.waterNum == '') {
							uni.showToast({
								title: '请输入水表数',
								icon: 'none',
								duration: 1500
							});
						}
						// else if (this.money(this.waterNum) == false) {
						// 	uni.showToast({
						// 		title: '请输入正确的水表数，可保留小数点后两位',
						// 		icon: 'none',
						// 		duration: 1500
						// 	});
						// } 
						else if (this.electricityNum == '') {
							uni.showToast({
								title: '请输入电表数',
								icon: 'none',
								duration: 1500
							});
						}
						// else if (this.money(this.electricityNum) == false) {
						// 	uni.showToast({
						// 		title: '请输入正确的电表数，可保留小数点后两位',
						// 		icon: 'none',
						// 		duration: 1500
						// 	});
						// }
						// else if (this.money(this.electricityNum) == false) {
						// 	uni.showToast({
						// 		title: '请输入正确的电表数，可保留小数点后两位',
						// 		icon: 'none',
						// 		duration: 1500
						// 	});
						// } 
						else if (this.gasNum == '') {
							uni.showToast({
								title: '请输入燃气表数',
								icon: 'none',
								duration: 1500
							});
						}
						// else if (this.money(this.gasNum) == false) {
						// 	uni.showToast({
						// 		title: '请输入正确的燃气表数，可保留小数点后两位',
						// 		icon: 'none',
						// 		duration: 1500
						// 	});
						// } 
						else if (this.otherUrlList.length == 0) {
							uni.showToast({
								title: '请上传水电燃气表，无则不需上传',
								icon: 'none',
								duration: 1500
							});
						} else if (this.refundWater == '') {
							uni.showToast({
								title: '请输入使用水费金额',
								icon: 'none',
								duration: 1500
							});
							money
						}
						// else if (this.money(this.refundWater) == false) {
						// 	uni.showToast({
						// 		title: '请输入正确的水费金额，可保留小数点后两位',
						// 		icon: 'none',
						// 		duration: 1500
						// 	});
						// } 
						else if (this.refundElectricity == '') {
							uni.showToast({
								title: '请输入使用电费金额',
								icon: 'none',
								duration: 1500
							});
						}
						// else if (this.money(this.refundElectricity) == false) {
						// 	uni.showToast({
						// 		title: '请输入正确的电费金额，可保留小数点后两位',
						// 		icon: 'none',
						// 		duration: 1500
						// 	});
						// } 
						else if (this.refundGas == '') {
							uni.showToast({
								title: '请输入使用燃气费金额',
								icon: 'none',
								duration: 1500
							});
						}
						// else if (this.money(this.refundGas) == false) {
						// 	console.log(this.refundGas);
						// 	uni.showToast({
						// 		title: '请输入正确的燃气费金额，可保留小数点后两位',
						// 		icon: 'none',
						// 		duration: 1500
						// 	});
						// } 
						else if (this.damages == '') {
							uni.showToast({
								title: '请输入赔偿金额',
								icon: 'none',
								duration: 1500
							});
						}
						// else if (this.money(this.damages) == false) {
						// 	uni.showToast({
						// 		title: '请输入正确的赔偿金额，可保留小数点后两位',
						// 		icon: 'none',
						// 		duration: 1500
						// 	});
						// } 
						else if (this.defaultPrice == '') {
							uni.showToast({
								title: '请输入违约金',
								icon: 'none',
								duration: 1500
							});
						}
						// else if (this.money(this.defaultPrice) == false) {
						// 	uni.showToast({
						// 		title: '请输入正确的违约金，可保留小数点后两位',
						// 		icon: 'none',
						// 		duration: 1500
						// 	});
						// } 
						else if (this.list.postCode == 'caiwu' && this.refundFileList.lenth == 0) {
							uni.showToast({
								title: '当前权限为财务，请上传发票图片',
								icon: 'none',
								duration: 1500
							});
						} else {
							this.api.post('hetong/contract/app/examineApp', data).then(res => {
								if (res.data.code == 200) {
									if (this.list.refundState == 1 || this.list.refundState == 4) {
										this.PicFun()
									}
									uni.showToast({
										title: '审核成功',
										icon: 'none',
										duration: 1500
									});
									setTimeout(function() {
										uni.navigateBack({
											delta: 1
										})
									}, 1000);
								} else {
									uni.showToast({
										title: res.data.msg,
										icon: 'none',
										duration: 1500
									});
								}
							})
						}
					} else {
						if (this.reject == '') {
							uni.showToast({
								title: '请输入驳回原因',
								icon: 'none',
								duration: 1500
							});
						} else {
							this.api.post('hetong/contract/app/examineApp', data).then(res => {
								if (res.data.code == 200) {
									uni.showToast({
										title: '驳回成功',
										icon: 'none',
										duration: 1500
									});

									setTimeout(function() {
										// uni.$emit('onShow', {
										// 	onShow: true
										// })
										// uni.navigateBack({
										// 	delta: 1
										// })
										uni.navigateBack({
											delta: 1,
											// success: function() {
											// 	const pages = getCurrentPages(); //获取当前页面栈
											// 	const prevPage = pages[pages.length -
											// 		1]; //获取上一个页面实例对象
											// 	prevPage.onLoad(); //调用上一个页面的onLoad方法
											// }
										});
									}, 1000);
								} else {
									uni.showToast({
										title: res.data.msg,
										icon: 'none',
										duration: 1500
									});
									setTimeout(function() {
										uni.navigateBack({
											delta: 1,
											// success: function() {
											// 	const pages = getCurrentPages(); //获取当前页面栈
											// 	const prevPage = pages[pages.length -
											// 		1]; //获取上一个页面实例对象
											// 	prevPage.onLoad(); //调用上一个页面的onLoad方法
											// }
										});
									}, 1000);
								}
							})
						}
					}
				} else {
					uni.showToast({
						title: '金额输入错误，请重新输入',
						icon: 'none',
						duration: 1500
					});
				}

			},

			/**
			 * 输入数字控制
			 */
			// numberCheck(val) {
			// 	var str = val;
			// 	var len1 = str.substr(0, 1);
			// 	var len2 = str.substr(1, 1);
			// 	//如果第一位是0，第二位不是点，就用数字把点替换掉
			// 	if (str.length > 1 && len1 == 0 && len2 != ".") {
			// 		str = str.substr(1, 1);
			// 	}

			// 	//如果第一位是0，第二位大于0
			// 	if (str.length > 1 && len1 == 0 && len2 > 0) {
			// 		str = str.substr(0, 1);
			// 	}
			// 	//第一位不能是.
			// 	if (len1 == ".") {
			// 		str = "";
			// 	}
			// 	//限制只能输入一个小数点
			// 	if (str.indexOf(".") != -1) {
			// 		var str_ = str.substr(str.indexOf(".") + 1);
			// 		if (str_.indexOf(".") != -1) {
			// 			str = str.substr(0, str.indexOf(".") + str_.indexOf(".") + 1);
			// 		}
			// 	}
			// 	//正则替换，保留数字和小数点
			// 	str = (str.match(/^\d*(\.?\d{0,1})/g)[0]) || null
			// 	return str;
			// },
		},

		computed: {
			getBalance() {
				this.refundPrice = this.list.refundDeposit * 1000 + this.list.refundRent * 1000 - this.refundWater *
					1000 -
					this
					.refundElectricity * 1000 - this
					.refundGas * 1000 - this.damages * 1000 - this.defaultPrice * 1000 - this.expirePrice * 1000

				this.refundPrice = this.refundPrice / 1000

				if (isNaN(this.refundPrice) && typeof(this.refundPrice) === 'number') {
					this.refundPrice = null
				}
			}
		},
	};
</script>

<style lang="scss">
	.fixed {
		width: 100%;
		height: 10vh;
		background-color: white;
		position: fixed;
		bottom: 0;
		z-index: 99;
	}

	.datetime {
		position: absolute;
		width: 55%;
		// height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: black;
		margin-top: -10rpx;
		// line-height: 40rpx;
		text-align: end;
	}

	.flex_most {
		width: 28rpx;
		height: 28rpx;
		margin-top: 5rpx;
	}

	.flex_logo {
		width: 28rpx;
		height: 28rpx;
		margin-top: 46rpx;
	}

	.logo {
		width: 80rpx;
		height: 80rpx;
		margin-top: 20rpx;
		margin-left: 310rpx;
	}

	.wrap {
		margin: 0 auto 54rpx;
		width: 718rpx;
	}

	.flex {
		display: flex;
		justify-content: flex-end;
	}

	.form_item_h {
		width: 718rpx;
		height: 40rpx;
		border-bottom: 1rpx solid #aaacba;
		display: flex;
		flex-wrap: nowrap;
		overflow: hidden;
		padding: 40rpx 0;
	}

	#submit {
		width: 660rpx;
		height: 112rpx;
		line-height: 112rpx;
		background: #ff6900;
		border-radius: 8rpx;
		text-align: center;
		font-size: 34rpx;
		font-family: PingFangSC-Semibold, PingFang SC;
		font-weight: 600;
		color: #FFFFFF;
		margin-top: 30rpx;
	}

	.gray_h {
		width: auto;
		height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #AAACAB;
		line-height: 40rpx;
		margin: 34rpx 0 44rpx 24rpx;
		box-sizing: border-box;
	}

	textarea {
		width: 564rpx;
		height: 190rpx;
		border: 2rpx solid #F7F4F4;
		margin: 0 auto;
		font-size: 28rpx;
		font-weight: 400;
		// color: #AAACAB;
		padding: 24rpx 38rpx 14rpx 38rpx;
	}

	.placeholder_textarea {
		font-size: 28rpx;
		font-weight: 400;
		color: #AAACAB;

	}

	.h {
		height: 48rpx;
		font-size: 34rpx;
		font-weight: 400;
		color: #1A1A1A;
		line-height: 48rpx;
		margin-left: 44rpx;
	}

	form {
		width: 718rpx;

		.form_item_logo {
			width: 718rpx;
			height: 120rpx;
			border-bottom: 1rpx solid #F7F4F4;
			display: flex;
			justify-content: flex-start;
			flex-wrap: nowrap;
			overflow: hidden;

			.label {
				width: 40%;
				height: 120rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: #AAACAB;
				line-height: 120rpx;

				.label_text {
					color: red;
					margin-left: 28rpx;
					margin-top: 16rpx;
					margin-right: 10rpx;
				}
			}

			.font_size {
				font-size: 28rpx;
				font-weight: 400;
				color: #AAACAB;
			}

			.input {
				width: 55%;
				height: 120rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: black;
				line-height: 120rpx;
				text-align: end;
			}

		}

		.uni-file-picker__container {
			display: flex;
			box-sizing: border-box;
			flex-wrap: wrap;
			margin: -5px;
			width: 660rpx;
			margin: 0 auto;
		}

		.from_file {
			width: 718rpx;
			height: 40rpx;
			border-bottom: 1rpx solid #F7F4F4;
			display: flex;
			justify-content: flex-start;
			flex-wrap: nowrap;
			overflow: hidden;
			padding: 40rpx 0 20rpx;

			.label {
				width: 40%;
				height: 40rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: #AAACAB;
				line-height: 40rpx;

				.label_text {
					color: red;
					margin-left: 28rpx;
					margin-top: 16rpx;
					margin-right: 10rpx;
				}
			}

			.input {
				width: 55%;
				height: 40rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: black;
				line-height: 40rpx;
				text-align: end;
			}

			.font_size {
				font-size: 28rpx;
				font-weight: 400;
				color: #AAACAB;
			}

			input {
				width: 55%;
				height: 40rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: black;
				line-height: 40rpx;
				text-align: end;
			}
		}


		.form_item {
			width: 718rpx;
			height: 40rpx;
			border-bottom: 1rpx solid #F7F4F4;
			display: flex;
			justify-content: flex-start;
			flex-wrap: nowrap;
			overflow: hidden;
			padding: 40rpx 0;


			.label {
				width: 40%;
				height: 40rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: #AAACAB;
				line-height: 40rpx;

				.label_text {
					color: red;
					margin-left: 28rpx;
					margin-top: 16rpx;
					margin-right: 10rpx;
				}
			}

			.input {
				width: 55%;
				height: 40rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: black;
				line-height: 40rpx;
				text-align: end;
			}

			.font_size {
				font-size: 28rpx;
				font-weight: 400;
				color: #AAACAB;
			}

			input {
				width: 55%;
				height: 40rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: black;
				line-height: 40rpx;
				text-align: end;
			}
		}
	}

	.btn {
		border-radius: 100rpx;
		text-align: center;
		height: 7vh;
		line-height: 7vh;
		width: 45%;
		color: #f3f3f3;
		margin: 1.5vh 0 1.5vh 0;
		font-size: 30rpx;
	}
</style>